var app = getApp(), api = require("../../api.js");
var images = require('../../utils/images.js');

Page({
    data: {
      showModal: false,
      showCancel: false,
      showTitle: '入驻规则',
      confirmColor: '#00a0e9',
      confirmContent: '我已阅读',
      typeIcon: images.nearbyShop.typeIcon,
      ruleIcon: images.nearbyShop.ruleIcon,
    },
    onLoad: function(n) {
        
    },
    showType: function(){
      wx.showActionSheet({
        itemList: ['自营商家', '附近商家', '特产美食'],
        success: function (res) {
          var i = res.tapIndex;
          wx.redirectTo({
            url: '/pages/entry-info/entry-info?type=' + i,
          });
        },
        fail: function (res) {
          console.log(res.errMsg)
        }
      })
    },
    showRule: function(){
      var that = this;
      app.request({
        url: api.mch.rule,
        success: function (d) {
          console.log(d);
          that.setData({
            showModal: true,
            modalContent: d.data.rule
          });
        },
        fail: function (d) {
          console.log(d);
          wx.showToast({
            title: '获取规则失败',
            image: "http://runwu100.img.guoxiaoge.cn/icon-warning.png"
          });
        }
      });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {}
});